﻿using System.Collections.Generic;
using System.Web.UI.WebControls;

namespace N2.BlogEngine.Items
{
	using N2.Details;
	using be = global::BlogEngine.Core;
	
	[WithEditableTitle]
	public class BePost: ContentItem
	{
		#region Collections

		public IList<string> Tags {
			get { return
				this.GetDetailCollection("Tags", true)
					.AsList<string>();
			}
		}

		public IList<BeCategory> Categories {
			get { return
				this.GetDetailCollection("Categories", true)
					.AsList<BeCategory>();
			}
		}

		public IList<string> NotificationEmails {
			get { return
					this.GetDetailCollection("NotificationEmails", true)
					.AsList<string>();
			}
		}

		#endregion Collections

		public override string Url {
			get {
				return this.AsBlogEngine().RelativeLink;
			}
		}

		public override string IconUrl { get { return "~/Edit/Img/ico/png/page_edit.png"; } }

		[EditableTextBox("Description", 05, TextMode = TextBoxMode.MultiLine)]
		public string Description {
			get { return this.GetDetail<string>("Description", null); }
			set { this.SetDetail<string>("Description", value); }
		}

		[EditableFreeTextArea("Content", 10)]
		public string Content {
			get { return this.GetDetail<string>("Content", null); }
			set { this.SetDetail<string>("Content", value); }
		}
	}
}
